@extends('web.layout')

@section('content')
    <div class="layui-container fly-marginTop fly-user-main">
        @include('web.user.nav')

        <div class="fly-panel fly-panel-user" pad20>
            <div class="layui-tab layui-tab-brief" lay-filter="user">
                <ul class="layui-tab-title" id="LAY_mine">
                    <li class="layui-this" lay-id="info">收支明细</li>
                    <li lay-id="info">惩罚记录</li>
                </ul>
                <div class="layui-tab-content" style="padding: 20px 0;">
                    <div class="layui-form layui-form-pane layui-tab-item layui-show">
                        <table class="layui-hide" id="table-list"></table>
                    </div>
                    <div class="layui-form layui-form-pane layui-tab-item">
                        <table class="layui-hide" id="table-list2"></table>
                    </div>
                </div>

            </div>
        </div>
    </div>
@endsection

@section('scripts')
    <script>
        layui.use(['form','table'], function(){
            var $ = layui.$
                ,form = layui.form
                ,layer = layui.layer
                ,table = layui.table;

            table.render({
                elem: '#table-list'
                ,url: "{{ url('/user-amountLogList') }}"
                ,cellMinWidth: 80
                ,cols: [[
                    {field:'id', title: '编号'}
                    ,{field:'amount', title: '变更金额',templet:function(d){
                        return d.type === 1 ? '<span style="color: red">'+d.amount+'</span>' : '<span style="color: green">'+d.amount+'</span>';
                     }}
                    ,{field:'after_amount', title: '变更后金额'}
                    ,{field:'type', title: '类型',templet:function(d){
                        return d.type === 1 ? '<span class="layui-badge">收入</span>' : '<span class="layui-badge layui-bg-green">支出</span>';
                     }}
                    ,{field:'class_name', title: '备注'}
                    ,{field:'updated_at',  title: '更新时间', width: '30%'}
                ]]
                ,loading: false
                ,page: {
                    layout: ['prev', 'page', 'next']
                }
            });

        });
    </script>
    <script>
        layui.use(['form','table'], function(){
            var $ = layui.$
                ,form = layui.form
                ,layer = layui.layer
                ,table = layui.table;

            table.render({
                elem: '#table-list2'
                ,url: "{{ url('/user-aFineList') }}"
                ,cellMinWidth: 80
                ,cols: [[
                    {field:'id', title: '编号'}
                    ,{field:'amount', title: '罚款金额',templet:function(d){
                            return '<span style="color: red">'+d.amount+'</span>';
                        }}
                    ,{field:'after_amount', title: '余额'}
                    ,{field:'type', title: '类型',templet:function(d){
                            return '<span class="layui-badge">罚款</span>';
                        }}
                    ,{field:'task_id', title: '任务号'}
                    ,{field:'class_name', title: '未完成任务', width: '30%'}
                    ,{field:'created_at',  title: '罚款时间', width: '18%'}
                ]]
                ,loading: false
                ,page: {
                    layout: ['prev', 'page', 'next']
                }
            });

        });
    </script>
@endsection